package com.wuwangfu.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

/**
 * @Description：解析Json字符串后生成的JavaBean
 * @Author：jcshen
 * @Date：2023-07-04
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class Behavior {

    public String userId;           // 用户ID
    public String itemId;           // 商品ID
    public String categoryId;       // 商品类目ID
    public String type;             // 用户行为, 包括("pv", "buy", "cart", "fav")
    public long timestamp;          // 行为发生的时间戳，单位秒
    public long counts = 1;

    public static Behavior of(String userId, String itemId, String categoryId, String type, long timestamp) {
        Behavior behavior = new Behavior();
        behavior.userId = userId;
        behavior.itemId = itemId;
        behavior.categoryId = categoryId;
        behavior.type = type;
        behavior.timestamp = timestamp;
        return behavior;
    }
}
